﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data.Objects;

namespace Returns
{
    /// <summary>
    /// Interaction logic for dlgSelectPackage.xaml
    /// </summary>
    public partial class SelectPackageDialog : Window
    {
        private PackageSearch[] _packages;

        public SelectPackageDialog(PackageSearch[] packages)
        {
            InitializeComponent();
            _packages = packages;
        }

        public Int32 PackageID { get; set; }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ((CollectionViewSource)FindResource("Packages")).Source = _packages;
        }

        private void btnSelect_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
            PackageID = (Int32)gridPackages.SelectedValue;
            Close();
        }
    }
}
